import mongoose from 'mongoose';
mongoose.set('strictQuery', true);

const mongoConnect = async () => {
    try {
        await mongoose.connect('mongodb://whu_425:whu_425@127.0.0.1:27017/aiwriter', {
            useNewUrlParser: true,
        });
        console.log('数据库连接成功');
    } catch (err) {
        console.log('数据库连接失败', err);
    }
};

export default mongoConnect;
